package com.bkgy.modular.sbdCalculate.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bkgy.modular.sbdCalculate.dto.SbdCalculateDto;
import com.bkgy.modular.sbdCalculate.entity.SbdCalculate;
import com.bkgy.modular.sbdCalculate.mapper.SbdCalculateMapper;
import com.bkgy.modular.sbdCalculate.service.SbdCalculateService;
import com.bkgy.modular.sbdCalculate.vo.SbdCalculateVo;
import com.bkgy.sys.common.entity.ResultData;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author
 * @version 1.0
 * @ClassName SbdCalculateServiceImpl
 * @date 2023/4/14 10:49
 */
@Service
public class SbdCalculateServiceImpl extends ServiceImpl<SbdCalculateMapper, SbdCalculate> implements SbdCalculateService {
    @Resource
    private SbdCalculateMapper mapper;

    /**
     * 同品规边降实际值&同品规边降预测值业务实现
     * @param dto
     * @return
     */
    @Override
    public ResultData findEdgWsPredAndfindEdmWsAvg(SbdCalculateDto dto) {
        String hot_coil_id = dto.getHot_coil_id();
        String discriminate = dto.getDiscriminate();
        if (StringUtils.isEmpty(hot_coil_id) && StringUtils.isEmpty(discriminate)) {
            return ResultData.ResultDataFaultSelf("参数有误",-1);
        }
        List<SbdCalculateVo> voList = null;
            voList = mapper.findEdmWsAvg(hot_coil_id);
        return ResultData.ResultDataFaultSelf("操作成功",voList);
    }
}
